import hextobin

try:
	f = open('t2.hex', 'r')
	#print(f.read())
	fr = f.read()
	print('hex')
	#print(fr)

	code = bytearray(fr)	
finally:
    if f:
        f.close()

code = hextobin.hex2bin(code)
print('code')
#print(code)

try:
    f = open('t2.bin', 'wb')
    f.write(code)
finally:
    if f:
         f.close()

input('Press any key to finish')
		